﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace L06
{
    class Triangle
    {
        public double a;
        public double b;
        public double c;
        public Triangle()
        {

        }
        public Triangle(double a, double b, double c)
        {
            this.a = a;
            this.b = b;
            this.c = c;
        }
        public void Perimeter()
        {
            Console.WriteLine("周长:{0}", a + b + c);
        }
        public void Area()
        {
            double r = (a + b + c) / 2;
            Console.WriteLine("面积:{0}", Math.Sqrt(r * (r - a) * (r - b) * (r - c)));
        }
        static void Main(string[] args)
        {
            int a, b, c;
            Triangle p = new Triangle(
             a = int.Parse(Console.ReadLine()),
             b = int.Parse(Console.ReadLine()),
             c = int.Parse(Console.ReadLine()));
            try
            {
                if (!(p.a + p.b > p.c && p.a - p.b < p.c))
                {
                    Console.WriteLine("输入的数字无法组成三角形");
                    Console.ReadKey();
                    return;
                }
            }
            catch
            {
                Console.WriteLine("请重新输入三个数字");

            }
            p.Perimeter();
            p.Area();
            Console.ReadKey();
        }
    }
}



